Skip to content

mod_autht_jwt: Fix silent bypass of JWT exp/nbf claim enforcement (BZ 70275) - #952

Open
arturobernalg wants to merge 1 commit into
apache:trunkfrom
arturobernalg:fix/bz70275-jwt-exp-nbf-numericdate
Open

arturobernalg wants to merge 1 commit into
apache:trunkfrom
arturobernalg:fix/bz70275-jwt-exp-nbf-numericdate

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

check_token() only accepted the "exp" and "nbf" NumericDate claims when their JSON value decoded to APR_JSON_LONG. RFC 7519 NumericDate is "a JSON numeric value" and does not have to be an integer literal: a value written with a decimal point or exponent (e.g. 1700000000.0) decodes to APR_JSON_DOUBLE, and a quoted numeric string decodes to APR_JSON_STRING. Either way the claim was silently dropped, exp_set/nbf_set stayed 0, and the whole expiry/not-before check was skipped, so an expired or not-yet-valid token was granted.

Accept APR_JSON_DOUBLE as a valid NumericDate (guarding against NaN/Inf and out-of-range values before the cast), and reject the token outright when "exp"/"nbf" is present with any other value type, instead of silently treating it as absent.

Reproduced live against a real httpd + apr-util 1.7 build: a validly-signed token with exp=1000000000.0 (float) or exp="1000000000" (string) was accepted (200) on unpatched code and correctly rejected (401) after the fix; a float nbf in the future was likewise accepted before the fix and rejected after. Confirmed the fix does not reject well-formed float NumericDate values that are still within their valid window.

PR: 70275

… 70275)

check_token() only accepted the "exp" and "nbf" NumericDate claims when
their JSON value decoded to APR_JSON_LONG. RFC 7519 NumericDate is "a
JSON numeric value" and does not have to be an integer literal: a value
written with a decimal point or exponent (e.g. 1700000000.0) decodes to
APR_JSON_DOUBLE, and a quoted numeric string decodes to APR_JSON_STRING.
Either way the claim was silently dropped, exp_set/nbf_set stayed 0, and
the whole expiry/not-before check was skipped, so an expired or
not-yet-valid token was granted.

Accept APR_JSON_DOUBLE as a valid NumericDate (guarding against NaN/Inf
and out-of-range values before the cast), and reject the token outright
when "exp"/"nbf" is present with any other value type, instead of
silently treating it as absent.

PR: 70275
@arturobernalg
arturobernalg force-pushed the fix/bz70275-jwt-exp-nbf-numericdate branch from fb95d18 to 49a071e Compare November 5, 2026 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant